package com.xxx.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxx.mapper.PingpaiMapper;
import com.xxx.pojo.Pingpai;
import com.xxx.service.PingpaiService;
import com.xxx.utils.RespPageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lczcr
 * @since 2022-11-04
 */
@Service
public class PingpaiServiceImpl extends ServiceImpl<PingpaiMapper, Pingpai> implements PingpaiService {


    @Autowired
    private PingpaiMapper pingpaiMapper;

    @Override
    public RespPageBean getPingpaiByPage(Integer currentPage, Integer size, Pingpai pingpai1) {
        //开启分页
        Page<Pingpai> page = new Page<>(currentPage,size);
        IPage<Pingpai> pingpaiByPage =pingpaiMapper.getPingpaiByPage(page,pingpai1);
        RespPageBean respPageBean = new RespPageBean(pingpaiByPage.getTotal(),pingpaiByPage.getRecords());

        return respPageBean;
    }
}
